﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using KP_CommonLibrary.Logs;
using KP_CommonLibrary.KP_CommonControls;
using KP_CommonLibrary;
using KEEPER_BRR_13dotNET.BusinessLogic;

namespace KEEPER_BRR_13dotNET.Presentation
{
    public partial class Frm_ThamSoTimKiem : KP_CommonLibrary.KP_CoreUI.KP_SearchForm
    {
        public Frm_ThamSoTimKiem()
        {
            InitializeComponent();
        }
        public override void Accept()
        {
            object[] arr = new object[6];
            Data = arr;
            base.Accept();
        }

        private void Frm_ThamSoTimKiem_Load(object sender, EventArgs e)
        {
            try
            {
                BL_KPDmTt _BLDmTt = new BL_KPDmTt();
                DataTable tblData= _BLDmTt.Select();
                DataRow newRow= tblData.NewRow();
                newRow["Ma_Tt"] = "-1";
                newRow["Ten_Tt"] = "Hiển thị tất cả";
                tblData.Rows.InsertAt(newRow, 0);
                cboTrangThai.DataSource = tblData;

                BL_KPDmPx _BLDmPx = new BL_KPDmPx();
                tblData = _BLDmTt.Select();
                newRow = tblData.NewRow();
                newRow["Ma_Px"] = "000000";
                newRow["Ten_Px"] = "Hiển thị tất cả";
                tblData.Rows.InsertAt(newRow, 0);
                cboXaPhuong.DataSource = tblData;

                BL_KPDmLoaiHs _BLDmLoaiHs = new BL_KPDmLoaiHs();
                tblData = _BLDmLoaiHs.Select();
                newRow = tblData.NewRow();
                newRow["Ma_LoaiHs"] = "000000";
                newRow["Ten_LoaiHs"] = "Hiển thị tất cả";
                tblData.Rows.InsertAt(newRow, 0);
                cboLoaiHs.DataSource = tblData;
            }
            catch (Exception ex)
            {
                LogUtil.Logger.Fatal("Load Tham số tìm kiếm", ex);
                KPMessageBox.Show("Load tham số tìm kiếm:\n" + ex.Message, KP_SYS_VARIABLE.M_KEEPER_VER, KPMessageBoxButton.OK, KPMessageBoxIcon.Error);
            }
        }
        
    }
}
